import { service2 } from "./custReq";
//获取总数据
function getListPage(
  url,
  data = {
    pageNum: 1,
    pageSize: 5,
  }
) {
  // return service2.post(url,{})
  return service2({
    method: "post",
    url: "/role" + url,
    data, //如果是post请求 data必须传哪怕为空
  });
}
//分页
function pagination(url, method, data) {
  return service2({
    url: "/role" + url,
    method,
    data,
  });
}
//查询列表数据
function selectMenuAll(url) {
  return service2({
    url: "/role" + url,
    method: "post",
  });
}
//添加权限
function sendCompetence(url, data) {
  return service2.post("/role" + url, data);
}
//点击编辑后,先拉取后端数据,都断数据的权限展示到对话框中勾选相应的东西
function editCompetence(url, data) {
  return service2.post("/role" + url, data);
}
//编辑后的数据发送给后端
function editSend(url, data) {
  return service2.post("/role" + url, data);
}
//切换状态
function switchStatus(url, data) {
  return service2.post("/role" + url, data);
}

export {
  getListPage,
  switchStatus,
  pagination,
  selectMenuAll,
  sendCompetence,
  editCompetence,
  editSend,
};
